/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Telas;

import javax.swing.JOptionPane;

/**
 *
 * @author note
 */
public class PrincipalFuncionario extends javax.swing.JFrame {

    /**
     * Creates new form Administrador
     */
    public PrincipalFuncionario() {
        initComponents();
    }
    /**
    * @params estudantes
    * @params carteirinhas
    * @params alteraSenha 
    */
    Estudantes estudantes;
    Carteirinhas carteirinhas;
    AlteraSenha alteraSenha;
    Login login;
    
    
   
    
    protected void mostraEstudantes(){
        if(estudantes == null){
            estudantes = new Estudantes();
            estudantes.setVisible(true);
        }else{
            estudantes.setVisible(true);
        }
    }
    protected void mostraCarteirinhas(){
        if(carteirinhas == null){
            carteirinhas = new Carteirinhas();
            carteirinhas.setVisible(true);
        }else{
            carteirinhas.setVisible(true);
        }
    }
    protected void mostraAlteraSenha(){
        if(alteraSenha == null){
            alteraSenha = new AlteraSenha();
            alteraSenha.setVisible(true);
        }else{
            alteraSenha.setVisible(true);
        }
    }
    
    
    protected void mostrarLogin(){
        if(login == null){
            login = new Login();
            login.setVisible(true);
        }else{
            login.setVisible(true);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btEstudante = new javax.swing.JButton();
        btCarteirinhas = new javax.swing.JButton();
        jMenuBar2 = new javax.swing.JMenuBar();
        menuAjuda = new javax.swing.JMenu();
        menuLogout = new javax.swing.JMenuItem();
        menuSobre = new javax.swing.JMenuItem();
        menuSair = new javax.swing.JMenuItem();
        menuConfiguracoes = new javax.swing.JMenu();
        menuAlteraSenha = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Carteirinhas");

        btEstudante.setText("Estudantes");
        btEstudante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btEstudanteActionPerformed(evt);
            }
        });

        btCarteirinhas.setText("Carteirinhas");
        btCarteirinhas.setPreferredSize(new java.awt.Dimension(100, 29));
        btCarteirinhas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCarteirinhasActionPerformed(evt);
            }
        });

        menuAjuda.setText("Opções");

        menuLogout.setText("Logout");
        menuLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuLogoutActionPerformed(evt);
            }
        });
        menuAjuda.add(menuLogout);

        menuSobre.setText("Sobre");
        menuSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSobreActionPerformed(evt);
            }
        });
        menuAjuda.add(menuSobre);

        menuSair.setText("Sair");
        menuSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSairActionPerformed(evt);
            }
        });
        menuAjuda.add(menuSair);

        jMenuBar2.add(menuAjuda);

        menuConfiguracoes.setText("Configurações");

        menuAlteraSenha.setText("Alterar Senha");
        menuAlteraSenha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuAlteraSenhaActionPerformed(evt);
            }
        });
        menuConfiguracoes.add(menuAlteraSenha);

        jMenuBar2.add(menuConfiguracoes);

        setJMenuBar(jMenuBar2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btEstudante, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btCarteirinhas, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(22, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btCarteirinhas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btEstudante))
                .addContainerGap(113, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSobreActionPerformed
        JOptionPane.showMessageDialog(null, "Sistema de Emissão de Carteirinhas v1.0 desenvolvido por: \nDayan Costa\nIury Rezende"
                + "\nLuciano Costa\nVitor Almeida");
    }//GEN-LAST:event_menuSobreActionPerformed

    private void btEstudanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btEstudanteActionPerformed
        mostraEstudantes();
       
    }//GEN-LAST:event_btEstudanteActionPerformed

    private void btCarteirinhasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCarteirinhasActionPerformed
        mostraCarteirinhas();
        
    }//GEN-LAST:event_btCarteirinhasActionPerformed

    private void menuAlteraSenhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAlteraSenhaActionPerformed
        mostraAlteraSenha();
       
    }//GEN-LAST:event_menuAlteraSenhaActionPerformed

    private void menuLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuLogoutActionPerformed
        mostrarLogin();
        this.dispose();
    }//GEN-LAST:event_menuLogoutActionPerformed

    private void menuSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSairActionPerformed
        if (JOptionPane.showConfirmDialog(null, "Esta ação irá sair do sistema por completo, confirma esta ação?", "ATENÇÃO!", JOptionPane.YES_NO_OPTION) == 0) {
            System.exit(0);
        }
    }//GEN-LAST:event_menuSairActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PrincipalFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PrincipalFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PrincipalFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PrincipalFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PrincipalFuncionario().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCarteirinhas;
    private javax.swing.JButton btEstudante;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenu menuAjuda;
    private javax.swing.JMenuItem menuAlteraSenha;
    private javax.swing.JMenu menuConfiguracoes;
    private javax.swing.JMenuItem menuLogout;
    private javax.swing.JMenuItem menuSair;
    private javax.swing.JMenuItem menuSobre;
    // End of variables declaration//GEN-END:variables
}
